function playSomeSound(genre) {
  SC.get('/playlists/61123863', {
    genres: genre,
    bpm: {
      from: 100
    }
  }, function(playlist) {
   // SC.stream("/tracks/" + , function(sound){
    //sound.play();
     //SC.oEmbed(tracks[0].uri, { auto_play: true }, 
      //function (track) {
        // body...
      //});
 var random = Math.floor(Math.random() * 49) %  playlist.tracks.length;
    alert(random);
    SC.oEmbed(playlist.tracks[random].uri, { auto_play: true }, document.getElementById('target'));
    //SC.stream("/tracks/" + playlist.tracks[random].id, function(sound){
    //sound.play();
    //});
  });
}

window.onload = function() {
  SC.initialize({
    client_id: '32b3fbd41d379a21d61d973af1a06563'
  });

  var menuLinks = document.getElementsByClassName('genre');
  for (var i = 0; i < menuLinks.length; i++) {
    var menuLink = menuLinks[i];
    menuLink.onclick = function(e) {
      e.preventDefault();
       alert(menuLink.innerHTML);
      playSomeSound(menuLink.innerHTML);
    };
  }
}
